# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: dorphell <dorphell@gmx.net>

pkgbase=unrar
pkgname=(unrar libunrar)
pkgver=5.6.8
pkgrel=1
epoch=1
arch=(x86_64)
url="http://www.rarlab.com/rar_add.htm"
license=(custom)
source=("http://www.rarlab.com/rar/unrarsrc-${pkgver}.tar.gz")
sha256sums=('a4cc0ac14a354827751912d2af4a0a09e2c2129df5766576fa7e151791dd3dff')

build() {
  cp -a unrar libunrar
  make -C libunrar lib
  make -C unrar STRIP="true"
}

package_unrar() {
  pkgdesc="The RAR uncompression program"
  depends=(gcc-libs)
  cd unrar
  install -Dm755 unrar "$pkgdir"/usr/bin/unrar
  # install license
  install -Dm644 license.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

package_libunrar() {
  pkgdesc="Library and header file for applications that use libunrar"
  depends=(gcc-libs)
  cd libunrar
  install -Dm755 libunrar.so "$pkgdir"/usr/lib/libunrar.so
  install -Dm644 dll.hpp "$pkgdir"/usr/include/unrar/dll.hpp
  # install license
  install -Dm644 license.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
